package com.yxx.sys.service.impl;

import com.yxx.sys.domain.Permission;
import com.yxx.sys.mapper.PermissionMapper;
import com.yxx.sys.service.PermissionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yxx
 * @since 2020-08-13
 */
@Service
@Transactional
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements PermissionService {

  @Autowired
  PermissionMapper permissionMapper;
  @Override
  public Integer loadMaxOrderNum() {
    return permissionMapper.loadMaxOrderNum();
  }

  @Override
  public boolean removeById(Serializable id) {
    //同步删除 （菜单和权限表）和（角色表）的中间表的数据
    permissionMapper.deleteRolePermissionById(id);

    //删除（菜单和权限表）的数据
    return super.removeById(id);
  }
}
